<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/src/sample.cpp File Reference</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#namespaces">Namespaces</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">sample.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;vector&gt;</code><br />
<code>#include &lt;NTL/ZZX.h&gt;</code><br />
<code>#include &lt;NTL/ZZ_pX.h&gt;</code><br />
<code>#include &lt;NTL/BasicThreadPool.h&gt;</code><br />
<code>#include &lt;<a class="el" href="_numb_th_8h_source.html">helib/NumbTh.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="_context_8h_source.html">helib/Context.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="sample_8h_source.html">helib/sample.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="norms_8h_source.html">helib/norms.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="api_attributes_8h_source.html">helib/apiAttributes.h</a>&gt;</code><br />
<code>#include &lt;<a class="el" href="powerful_8h_source.html">helib/powerful.h</a>&gt;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacehelib"><td class="memItemLeft" align="right" valign="top"> &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html">helib</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a3cebf12977a97396ba96bdc5fe8162e7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a3cebf12977a97396ba96bdc5fe8162e7">helib::sampleHWt</a> (zzX &amp;poly, long n, long Hwt=100)</td></tr>
<tr class="memdesc:a3cebf12977a97396ba96bdc5fe8162e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sample a degree-(n-1) poly as above, with only Hwt nonzero coefficients.  <a href="namespacehelib.html#a3cebf12977a97396ba96bdc5fe8162e7">More...</a><br /></td></tr>
<tr class="separator:a3cebf12977a97396ba96bdc5fe8162e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa510a5dd7033e859ab4e6759a1b1b207"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#aa510a5dd7033e859ab4e6759a1b1b207">helib::sampleHWt</a> (NTL::ZZX &amp;poly, long n, long Hwt=100)</td></tr>
<tr class="separator:aa510a5dd7033e859ab4e6759a1b1b207"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc5ec6f6ac945f2c5bcdf04fb7bcf0a9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#abc5ec6f6ac945f2c5bcdf04fb7bcf0a9">helib::sampleSmall</a> (zzX &amp;poly, long n, double prob=0.5)</td></tr>
<tr class="separator:abc5ec6f6ac945f2c5bcdf04fb7bcf0a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7aab1a9871644fc36223b8009290ef66"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a7aab1a9871644fc36223b8009290ef66">helib::sampleSmall</a> (NTL::ZZX &amp;poly, long n, double prob=0.5)</td></tr>
<tr class="separator:a7aab1a9871644fc36223b8009290ef66"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adccfccbd4c008360cc40afa2fa8bc3ad"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#adccfccbd4c008360cc40afa2fa8bc3ad">helib::sampleGaussian</a> (std::vector&lt; double &gt; &amp;dvec, long n, double stdev)</td></tr>
<tr class="memdesc:adccfccbd4c008360cc40afa2fa8bc3ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Choose a vector of continuous Gaussians.  <a href="namespacehelib.html#adccfccbd4c008360cc40afa2fa8bc3ad">More...</a><br /></td></tr>
<tr class="separator:adccfccbd4c008360cc40afa2fa8bc3ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ca8304d01fccbbac9264eee5d5a24cb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a9ca8304d01fccbbac9264eee5d5a24cb">helib::sampleGaussian</a> (zzX &amp;poly, long n, double stdev)</td></tr>
<tr class="memdesc:a9ca8304d01fccbbac9264eee5d5a24cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sample polynomials with Gaussian coefficients.  <a href="namespacehelib.html#a9ca8304d01fccbbac9264eee5d5a24cb">More...</a><br /></td></tr>
<tr class="separator:a9ca8304d01fccbbac9264eee5d5a24cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d1e9c8e38d8a8f73b315b2cf874cebe"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a6d1e9c8e38d8a8f73b315b2cf874cebe">helib::sampleGaussian</a> (NTL::ZZX &amp;poly, long n, double stdev)</td></tr>
<tr class="separator:a6d1e9c8e38d8a8f73b315b2cf874cebe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b922617fd57c98218c1eada9ffb9cb5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a7b922617fd57c98218c1eada9ffb9cb5">helib::sampleUniform</a> (zzX &amp;poly, long n, long B=100)</td></tr>
<tr class="memdesc:a7b922617fd57c98218c1eada9ffb9cb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sample a degree-(n-1) ZZX, with coefficients uniform in [-B,B].  <a href="namespacehelib.html#a7b922617fd57c98218c1eada9ffb9cb5">More...</a><br /></td></tr>
<tr class="separator:a7b922617fd57c98218c1eada9ffb9cb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2882109801afa606ee6ec39f6fd48348"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a2882109801afa606ee6ec39f6fd48348">helib::sampleUniform</a> (NTL::ZZX &amp;poly, long n, const NTL::ZZ &amp;B=NTL::ZZ(100L))</td></tr>
<tr class="separator:a2882109801afa606ee6ec39f6fd48348"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af97518f36b0358f1f178ce85e51c5d82"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#af97518f36b0358f1f178ce85e51c5d82">helib::sampleHWt</a> (zzX &amp;poly, const Context &amp;context, long Hwt=100)</td></tr>
<tr class="separator:af97518f36b0358f1f178ce85e51c5d82"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8e75ae20952ceae0b4e92034d7128457"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a8e75ae20952ceae0b4e92034d7128457">helib::sampleHWtBoundedEffectiveBound</a> (const Context &amp;context, long Hwt=100)</td></tr>
<tr class="separator:a8e75ae20952ceae0b4e92034d7128457"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae703021ed961c9a45e32d09c4b965781"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#ae703021ed961c9a45e32d09c4b965781">helib::sampleHWtBounded</a> (zzX &amp;poly, const Context &amp;context, long Hwt=100)</td></tr>
<tr class="separator:ae703021ed961c9a45e32d09c4b965781"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa20a241c380919c47e8375ac01d61187"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#aa20a241c380919c47e8375ac01d61187">helib::sampleSmall</a> (zzX &amp;poly, const Context &amp;context)</td></tr>
<tr class="separator:aa20a241c380919c47e8375ac01d61187"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a50866077cb1daad6200cd8b374613539"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a50866077cb1daad6200cd8b374613539">helib::sampleSmallBounded</a> (zzX &amp;poly, const Context &amp;context)</td></tr>
<tr class="separator:a50866077cb1daad6200cd8b374613539"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d8ea79ceef3847786a1f9422fc011e7"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a1d8ea79ceef3847786a1f9422fc011e7">helib::sampleGaussian</a> (zzX &amp;poly, const Context &amp;context, double stdev)</td></tr>
<tr class="separator:a1d8ea79ceef3847786a1f9422fc011e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc2cb417d4cb136fe2f25fea08aaff16"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#abc2cb417d4cb136fe2f25fea08aaff16">helib::sampleGaussianBounded</a> (zzX &amp;poly, const Context &amp;context, double stdev)</td></tr>
<tr class="separator:abc2cb417d4cb136fe2f25fea08aaff16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa21875fc9b1d3c8dad59e1c3f66f0718"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#aa21875fc9b1d3c8dad59e1c3f66f0718">helib::sampleUniform</a> (zzX &amp;poly, const Context &amp;context, long B=100)</td></tr>
<tr class="separator:aa21875fc9b1d3c8dad59e1c3f66f0718"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c90da3ab82439eb3574afc268f88050"><td class="memItemLeft" align="right" valign="top">NTL::xdouble&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a5c90da3ab82439eb3574afc268f88050">helib::sampleUniform</a> (NTL::ZZX &amp;poly, const Context &amp;context, const NTL::ZZ &amp;B=NTL::ZZ(100L))</td></tr>
<tr class="separator:a5c90da3ab82439eb3574afc268f88050"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c4cfecd6dc28011302b7b86d15dbaa9"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a5c4cfecd6dc28011302b7b86d15dbaa9">helib::boundRoundingNoise</a> (<a class="el" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> long m, long phim, long p2r, double epsilon)</td></tr>
<tr class="separator:a5c4cfecd6dc28011302b7b86d15dbaa9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader"></div></td></tr>
<tr class="memitem:a60c561d9f496e4d62c96dfab1e5040a4"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacehelib.html#a60c561d9f496e4d62c96dfab1e5040a4">helib::boundFreshNoise</a> (long m, long phim, double sigma, double epsilon=9e-13)</td></tr>
<tr class="separator:a60c561d9f496e4d62c96dfab1e5040a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
